package com.eliza.databindadv.activity

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager
import com.eliza.databindadv.R
import com.eliza.databindadv.databinding.ActivityBindRecycleBinding
import com.eliza.databindadv.model.User
import com.eliza.databindadv.recycleView.RecycleBindAdapter


/*-*- coding:utf-8 -*-
 * @Author  : debi
 * @Time    : 3/26/22
 * @Software: Android Studio
 */
class RecycleBindActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        var useList = arrayListOf<User>()
        for (i in 0..10) {
            useList.add(User("a$i", i))

        }
        /*Expected:
        ViewDataBinding!
        Found:
        ActivityMainBinding!
        */
        val dbv = DataBindingUtil.setContentView<ActivityBindRecycleBinding>(
            this,
            R.layout.activity_bind_recycle

        )
        dbv.mainToDatabindRecycleVmRv.layoutManager = LinearLayoutManager(this)
        dbv.mainToDatabindRecycleVmRv.adapter = RecycleBindAdapter(useList)


    }
}